Skip to content

Fix compliance findings in Frends.JSON.Validate (net8, analyzers, error handling) - #44

Merged
MatteoDelOmbra merged 8 commits into
mainfrom
copilot/fix-compliance-findings-again
Aug 13, 2026
Merged

Fix compliance findings in Frends.JSON.Validate (net8, analyzers, error handling)#44
MatteoDelOmbra merged 8 commits into
mainfrom
copilot/fix-compliance-findings-again

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Resolves 5 Frends Task analyzer findings and upgrades the task to .NET 8, adding standard error-handling options in the process.

Changes

Compliance fixes

  • JSON class made static (FT0004)
  • CancellationToken parameter added to Validate() (FT0007)
  • Error property added to Result (FT0011)
  • ThrowErrorOnFailure and ErrorMessageOnFailure added to Options (FT0015 ×2)

Infrastructure

  • Both projects retargeted from net6.0net8.0
  • Version bumped 1.0.01.1.0

Error handling
Added Helpers/ErrorHandler.cs (standard pattern). Validate() now wraps all logic in a top-level try/catch:

catch (Exception ex)
{
    return ex.Handle(options); // respects ThrowErrorOnFailure / ErrorMessageOnFailure
}

The existing ThrowOnInvalidJson behaviour is preserved inside the inner try/catch.

Tests

  • Existing tests updated with CancellationToken.None
  • ErrorHandlerTests.cs added covering throw-on-failure, return-failed-result, and custom error message scenarios

Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compliance findings in Frends.JSON.Validate Fix compliance findings in Frends.JSON.Validate (net8, analyzers, error handling) Aug 5, 2026
Copilot AI requested a review from MichalFrends1 August 5, 2026 10:15
@@ -10,4 +13,20 @@ public class Options
/// </summary>
/// <example>true</example>
public bool ThrowOnInvalidJson { get; set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot rename ThrowOnInvalidJson to FailOnInvalidJson everywhere (option property, XML docs, usages in code). The reason is that ThrowErrorOnFailure now decides whether to throw or return Success=false, so the old name was misleading - FailOnInvalidJson only controls whether invalid JSON is treated as an error at all.
his is a breaking change due to renamed option, so bump version to 2.0.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Renamed ThrowOnInvalidJson to FailOnInvalidJson in Options.cs, Validate.cs, and all test files, and bumped the version to 2.0.0. The CHANGELOG documents this as a breaking change. Commit: Rename ThrowOnInvalidJson to FailOnInvalidJson, bump version to 2.0.0.

Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
Comment thread Frends.JSON.Validate/CHANGELOG.md
Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
…ency"

This reverts commit 980fb5b.

Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
@MichalFrends1
MichalFrends1 marked this pull request as ready for review August 13, 2026 06:03
@MatteoDelOmbra
MatteoDelOmbra merged commit ef0764b into main Aug 13, 2026
5 checks passed
@MatteoDelOmbra
MatteoDelOmbra deleted the copilot/fix-compliance-findings-again branch August 13, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants